package org.example.sys.service

import org.example.sys.bean.Book
import org.example.sys.bean.ResponseData
import org.example.sys.bean.TableData
import retrofit2.Call
import retrofit2.http.Body
import retrofit2.http.HTTP
import retrofit2.http.Path

interface BookApi {

    @HTTP(method = "GET", path = "book/{pageNo}/{pageSize}")
    fun get(
        @Path("pageNo") pageNo: Int,
        @Path("pageSize") pageSize: Int
    ): Call<ResponseData<TableData<Book>>>

    @HTTP(method = "GET", path = "book/{id}")
    operator fun get(@Path("id") id: Int): Call<ResponseData<Book>>

    @HTTP(method = "POST", path = "book",hasBody = true)
    fun saveOrUpdate(@Body book: Book): Call<ResponseData<Book>>

    @HTTP(method = "DELETE", path = "book/{id}")
    fun delete(@Path("id") id: Int): Call<ResponseData<Book>>
}